package com.read.aspectj;

import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Aspect
public class Guardian {
	
	private static final Logger log = LoggerFactory.getLogger(Guardian.class);
	
	@Pointcut("execution (* com.read.aspectj.Monkey.toutao(..))")
	public void foundMonkey(){}
	
	@Before(value="foundMonkey()") 
	public void foundBefore(){
		log.info("守护者发现了猴子正在进入果园。。。。");
	}
	
	@AfterReturning("foundMonkey() && args(name,age,..)") 
	public void foundAtfer(String name,int age){
		log.info("守护者抓住了猴子，守护者审问出猴子的名字叫：{},今年{}岁了",name,age);
	}
	
}
